`import models.Ingredient.Unit
`args Float number, Unit unit
%{
    boolean printUnit = false;
    String count = null;
    if (number % 1 == 0) {
        count = String.valueOf(number.intValue());
        printUnit = true;
    } else {
        if (unit == Unit.PCS && number == 0.5) {
            count = "половинка";
        } else {
            count = String.valueOf(number);
	        printUnit = true;
        }
    }
    
    p(count);
    if (printUnit) {
    	p(" ");
    	// print unit
        if (unit == Unit.GRAM) {
            p("г");
        } else if (unit == Unit.PCS) {
            p("шт.");
        } else if (unit == Unit.TABLESPOON) {
            p("ст.л.");
        } else if (unit == Unit.TEASPOON) {
            p("ч.л");
        } else if (unit == Unit.GLASS) {
            p(number == 1 ? "стакан" : "стакана");
        }
        p("");
    
    }
}%